keymap = {
    'Q': 1,
    'W': 1,
    'E': 1,
    'R': 1,
    'T': 1,
    'Y': 1,
    'U': 1,
    'I': 1,
    'O': 1,
    'P': 1,
    'A': 2,
    'S': 2,
    'D': 2,
    'F': 2,
    'G': 2,
    'H': 2,
    'J': 2,
    'K': 2,
    'L': 2,
    'Z': 3,
    'X': 3,
    'C': 3,
    'V': 3,
    'B': 3,
    'N': 3,
    'M': 3,
}

def is_in_oneline(word):
    if len(word) == 0:
        return True

    line = keymap[word[0].upper()]
    for c in word[1:]:
        if keymap[c.upper()] != line:
            return False

    return True

class Solution:
    def findWords(self, words):
        return list(filter(is_in_oneline, words))

s = Solution()
print(s.findWords(["Hello", "Alaska", "Dad", "Peace"]))
